<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" href="../layuiadmin/style/wu.css" media="all">
    <link rel="stylesheet" href="../layuiadmin/style/template.css" media="all">
    <title></title>
    <style>
        .layui-laydate-range {
            width: 547px !important;
        }
    </style>
</head>

<body>
    <div class="layui-fluid">
        <form class="layui-card layui-form" style="padding: 10px;">
            <div class="layui-form-item">
                <label class="layui-form-label">名称</label>
                <div class="layui-input-block">
                    <input type="text" name="name" required lay-verify="required" placeholder="请输入名称"
                        autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">限制类型</label>
                <div class="layui-input-block">
                    <select name="type" lay-verify="required">
                        <option value="">请选择</option>
                        <option value="只接受指定格式">只接受指定格式</option>
                        <option value="不接受指定格式">不接受指定格式</option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">限制格式</label>
                <div class="layui-input-block">
                    <input type="checkbox" name="fileSuffix" title="jpg"  value="jpg">
                    <input type="checkbox" name="fileSuffix" title="png"  value="png">
                    <input type="checkbox" name="fileSuffix" title="gif"  value="gif">
                    <input type="checkbox" name="fileSuffix" title="jpeg" value="jpeg">
                    <input type="checkbox" name="fileSuffix" title="bmp"  value="bmp">
                    <input type="checkbox" name="fileSuffix" title="rar"  value="rar">
                    <input type="checkbox" name="fileSuffix" title="zip"  value="zip">
                    <input type="checkbox" name="fileSuffix" title="txt"  value="txt">
                    <input type="checkbox" name="fileSuffix" title="wps"  value="wps">
                    <input type="checkbox" name="fileSuffix" title="doc"  value="doc">
                    <input type="checkbox" name="fileSuffix" title="docx" value="docx">
                    <input type="checkbox" name="fileSuffix" title="ppt"  value="ppt">
                    <input type="checkbox" name="fileSuffix" title="pptx" value="pptx">
                    <input type="checkbox" name="fileSuffix" title="xls"  value="xls">
                    <input type="checkbox" name="fileSuffix" title="xlsx" value="xlsx">
                    <input type="checkbox" name="fileSuffix" title="pdf"  value="pdf">
                    <input type="checkbox" name="fileSuffix" title="ofd"  value="ofd">
                    <input type="checkbox" name="fileSuffix" title="asp"  value="asp">
                    <input type="checkbox" name="fileSuffix" title="js"   value="js">
                    <input type="checkbox" name="fileSuffix" title="css"  value="css">
                    <input type="checkbox" name="fileSuffix" title="exe"  value="exe">
                    <input type="checkbox" name="fileSuffix" title="bat"  value="bat">
                    <input type="checkbox" name="fileSuffix" title="aspx" value="aspx">
                    <input type="checkbox" name="fileSuffix" title="html" value="html">


                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">附件大小</label>
                <div class="layui-input-inline">
                    <input type="number" name="fileSize" required lay-verify="required" placeholder="请输入附件大小"
                        autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">（ 单位：MB ）</div>
            </div>
        </form>
    </div>
</body>
<script src="../js/tool/sweetalert.js"></script>
<script src="../layuiadmin/layui/layui.min.js"></script>
<script>
    var $ = "";
    function init(data) {
        layui.use(['form'], function () {
            var form = layui.form;
            $ = layui.$;

            $('input[name=name]').val(data.MC);
            $('select[name=type]').val(data.XZLX);
            $.each(data.XZGS && data.XZGS.split("、") || [], function (index, item) {
                $('input[name=fileSuffix][title=' + item + ']').attr("checked", true);
            })
            $('input[name=fileSize]').val(data.FJDX);
            form.render();
        });
    }
            function getResult() {
                var types = [];
                $.each($('input[name=fileSuffix]:checked'), function (index, item) {
                    types.push($(item).val());
                })
                return {
                    MC: $('input[name=name]').val(),
                    XZLX: $('select[name=type]').val(),
                    XZGS: types.join("、"),
                    FJDX: $('input[name=fileSize]').val() || 0
                }
    }
</script>

</html>